import Vue from 'vue'
import vueRouter from 'vue-router'
const indexPage = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_INDEX : window.webConfig.webIndexPage
Vue.use(vueRouter);

// 检票员端路由
let inspectorRoutes = [
  {
    path: '/ilogin',
    component: () => import('@/pagesInspector/login/login'),
  },
  {
    path: '/ihome',
    name: 'ihome',
    component: () => import('@/pagesInspector/home'),
    children: [
      {
        path: '/iticketcheck',
        name: 'tcheck',
        component: () => import('@/pagesInspector/ticket/check'),
      },
      {
        path: '/ibusbind',
        name: 'bbind',
        component: () => import('@/pagesInspector/shuttleBus/bind'),
      },
      {
        path: '/ipersonal',
        name: 'cpersonal',
        component: () => import('@/pagesInspector/personal/personal'),
      },
    ],
  },
  {
    path: '/iticketrec',
    name: 'trec',
    component: () => import('@/pagesInspector/ticket/record'),
  },
  {
    path: '/iticketdetl',
    name: 'tdetl',
    component: () => import('@/pagesInspector/ticket/detail'),
  },

  {
    path: '/ibuslist',
    name: 'blist',
    component: () => import('@/pagesInspector/shuttleBus/list'),
  },
  {
    path: '/ibusvideo',
    name: 'tvideo',
    component: () => import('@/pagesInspector/ticket/video'),
  },
]

//定制线路路由
let customRoutes = [
  {
    path: '/chome',
    component: () => import('@/pagesCustom/home/home'),
  },
  {
    path: '/cagreementList',
    component: () => import('@/pagesCustom/agreementList/agreementList'),
  },
  {
    path: '/cbuyTicket',
    component: () => import('@/pagesCustom/buyTicket/buyTicket'),
  },
  {
    path: '/cpassengerList',
    component: () => import('@/pagesCustom/passengerList/passengerList'),
  },
  {
    path: '/cticketRecord',
    component: () => import('@/pagesCustom/ticketRecord/ticketRecord'),
  },
  {
    path: '/cticketDetail',
    component: () => import('@/pagesCustom/ticketDetail/ticketDetail'),
  },
]
// 测试页面路由
let testRoutes = [
  {
    path: '/thome',
    component: () => import('@/pagesTest/home/home'),
  },
]

//定义路由
export const routes = [
  { path:'*',
    redirect: indexPage
  },
  {
    path: '/index',
    component: () => import('@/pages/index'),
  },
  {
    path: '/register',
    component: () => import('@/pages/register/register'),
  },
  {
    path: '/buyTicket',
    component: () => import('@/pages/buyTicket/buyTicket'),
  },
  {
    path: '/passengerList',
    component: () => import('@/pages/passengerList/passengerList'),
  },
  {
    path: '/passengerDetail',
    component: () => import('@/pages/passengerDetail/passengerDetail'),
  },
  {
    path: '/guardian',
    component: () => import('@/pages/guardian/guardian'),
  },
  {
    path: '/ticketRecord',
    component: () => import('@/pages/ticketRecord/ticketRecord'),
  },
  {
    path: '/ticketDetail',
    component: () => import('@/pages/ticketDetail/ticketDetail'),
  },
  {
    path: '/agreementList',
    component: () => import('@/pages/agreementList/agreementList'),
  },
  {
    path: '/receipt',
    component: () => import('@/pages/receipt/receipt')
  },
  {
    path: '/fieldDemo',
    component: () => import('@/components/field/demo/fieldDemo')
  },
  {
    path: '/formDemo',
    component: () => import('@/components/form/demo/formDemo')
  },
  {
    path: '/watermark',
    component: () => import('@/pages/watermark/watermark')
  },
  {
    path: '/payIndex',
    component: () => import('@/pages/payIndex/payIndex')
  },
  {
    path: '/paidList',
    component: () => import('@/pages/paidList/paidList')
  },
  {
    path: '/paidDetail',
    component: () => import('@/pages/paidDetail/paidDetail')
  },
  /*{
    path: '/leaveList',
    component: () => import('@/pages/leaveList/leaveList')
  },*/
  {
    path: '/leaveDetail',
    component: () => import('@/pages/leaveDetail/leaveDetail')
  },
  {
    path: '/leaveAsk',
    component: () => import('@/pages/leaveAsk/leaveAsk')
  },
  {
    path: '/leaveAskedList',
    component: () => import('@/pages/leaveAskedList/leaveAskedList')
  },
  {
    path: '/leaveAskNoOrder',
    component: () => import('@/pages/leaveAskNoOrder/leaveAskNoOrder')
  },
  {
    path: '/leaveAskedListNoOrder',
    component: () => import('@/pages/leaveAskedList/leaveAskedListNoOrder')
  },
  ...inspectorRoutes,

  { // 231204 liang 推文
    path: '/tweet',
    component: () => import('@/pages/tweet/tweet')
  },

  ...customRoutes,

  ...testRoutes
]


export default new vueRouter({
  mode: 'history',
  // base: "/SchoolBusWechat/",
  base: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_SECONDDIR : window.webConfig.webSecondDir,
  routes
})
